import request from "@/utils/request";
import Cookies from "js-cookie";
export function login(data) {
  let uri = "/receptionLogin";
  return request({
    url: uri,
    method: "post",
    data,
  });
}
// export function login(username, password, code, uuid, type) {
//   let uri = "/receptionLogin";
//   return request({
//     url: uri,
//     method: "post",
//     data: {
//       username,
//       password,
//       code,
//       uuid,
//     },
//   });
// }

export function register(username, password, code, uuid, type) {
  let uri = "/register";
  return request({
    url: uri,
    method: "post",
    data: {
      username,
      password,
      code,
      uuid,
    },
  });
}

export function retrievePassword(userName, password, oldPassword, uuid, type) {
  let uri = "/resetUserPwd";
  return request({
    url: uri,
    method: "put",
    data: {
      userName,
      password,
      oldPassword,
      uuid,
    },
  });
}

export function getInfo() {
  let userType = Cookies.get("userType");
  let uri = "auth/info";
  if (userType === "hy") {
    //会员登录
    uri = "memberApi/userinfo";
  }
  return request({
    url: uri,
    method: "get",
  });
}

export function getCodeImg() {
  return request({
    url: "auth/code",
    method: "get",
  });
}

export function getCodeImgMember() {
  return request({
    url: "memberApi/code",
    method: "get",
  });
}

export function logout() {
  return request({
    url: "auth/logout",
    method: "delete",
  });
}

// 获取用户信息
export function getUserInfo() {
  return request({ url: "/getUserValue", method: "get" });
}
